#Copyright 2003, Cypress Semiconductor Corporation

#*****************************************************************************#

#This software is owned by Cypress Semiconductor Corporation (Cypress) and is

#protected by United States copyright laws and international treaty provisions.

#Cypress hereby grants to Licensee a personal, non-exclusive, non-transferable 

#license to copy, use, modify, create derivative works of, and compile the 

#Cypress Source Code and derivative works for the sole purpose of creating 

#custom software in support of Licensee product ("Licensee Product") to be 

#used only in conjunction with a Cypress integrated circuit. Any reproduction, 

#modification, translation, compilation, or representation of this software 

#except as specified above is prohibited without the express written permission

#of Cypress.





#Disclaimer: Cypress makes no warranty of any kind, express or implied, with 

#regard to this material, including, but not limited to, the implied warranties

#of merchantability and fitness for a particular purpose. Cypress reserves the 

#right to make changes without further notice to the materials described 

#herein. Cypress does not assume any liability arising out of the application 

#or use of any product or circuit described herein. Cypress products described

# herein are not authorized for use as components in life-support devices.

#This software is protected by and subject to worldwide patent coverage, 

#including U.S. and foreign patents. Use may be limited by and subject to 

#the Cypress Software License Agreement.

#*****************************************************************************#



# *******************************************************************

# File           : run_ncvhdl

# Author         : Hasib MAnnil  

# Author's Email : hbm@cypress.com

# Date           : 30 AUG,2003 

# Revision       : 1.1  

# *******************************************************************

# Description : This script is to run the VHDL model simualtion with 

# NC-VHDL Simulator 

#

# *******************************************************************

#!/bin/csh

##############################################################################

set m = `echo $1 | cut -d"." -f1`

set p = `pwd`



set model_dir = $p/../../VHDL/model

set run_dir   = $p/../../VHDL/run

set rpt_dir = $p/../../VHDL/rpt

set tb_dir = $p/../../VHDL/tb

#############################Clear the RPT directory #######################

cd $tb_dir

if("$2" != "8") then

cd $rpt_dir

echo " Do you want to remove all log and VCD files from rpt directory(Y/N): Default is No "

echo " Enter an Option:"

set resp5 = $<

if(("$resp5" == "Y") || ("$resp5" == "y")) then

\rm -rf *.vcd

\rm -rf *.log

\rm -rf *.trn

\rm -rf *.dsn

endif

cd $tb_dir

#######################################################################################

echo " Do you want to generate VCD file(Y/N) : Default is No "

echo " Enter an Option:"

set res1 = $<

cd $tb_dir

##echo SIMULATION STARTED AT `date`  >>$run_dir/cmd

echo " cd $tb_dir" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/pack_disp_conv_dis.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/test_tasks_pkg_rx.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/test_tasks_pkg_tx.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/txerr_ref.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/lfi_ref.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/SingleChannel_rx.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/SingleChannel_tx.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/SingleChannel.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/latchs.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/cyp15g0403dxb.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status clk_gena.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status add_tasks.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $1" >>$run_dir/cmd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/pack_disp_conv_dis.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/test_tasks_pkg_rx.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/test_tasks_pkg_tx.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/txerr_ref.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/lfi_ref.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/SingleChannel_rx.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/SingleChannel_tx.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/SingleChannel.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/latchs.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/cyp15g0403dxb.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status clk_gena.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status add_tasks.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $1



echo "ncelab -work worklib -cdslib cds.lib -logfile ncelab.log -access +wc -status worklib.cyp15g0403dxb_tb_top:test" >>$run_dir/cmd 

ncelab -work worklib -cdslib cds.lib -logfile ncelab.log -access +wc -status worklib.cyp15g0403dxb_tb_top:test 



echo "ncsim worklib.cyp15g0403dxb_tb_top:test -input @"\""database -open vcddb -vcd   -timescale ps; probe -vcd -all -depth all; run; exit"\"";" >>$run_dir/cmd 

ncsim worklib.cyp15g0403dxb_tb_top:test -input @"database -open vcddb -vcd   -timescale ps; probe -vcd -all -depth all; run; exit"; 



echo "mv ncsim.log $rpt_dir/$m.log" >>$run_dir/cmd

mv ncsim.log $rpt_dir/$m.log

cd $run_dir

if (("$res1" == "Y") || ("$res1" == "y")) then

cd $tb_dir

echo "mv ncsim.vcd $rpt_dir/$m.vcd" >>$run_dir/cmd 

mv ncsim.vcd $rpt_dir/$m.vcd 

cd $run_dir

else

;

endif

cd $tb_dir

\rm -rf *.vcd 

cd $rpt_dir

##echo SIMULATION ENDED AT `date`  >>$run_dir/cmd

\rm -rf $run_dir/run_default

mv $run_dir/cmd $run_dir/run_default

chmod 755 $run_dir/run_default

set s1 = `grep -n PASS $m.log | wc -l`

echo "The testcase = $m"

echo " TOTAL PASS= $s1"

set s2 = `grep -n FAIL $m.log | wc -l`

echo " TOTAL FAIL = $s2"

if (($s2 == 0 ) && ($s1 > 0)) then

echo " Test $m is PASSED "

else if (($s2 == 0)  && ($s1 == 0))  then

echo " Test $m is not simulated "

else

echo "Test $m is FAILED"

endif

echo $1

cd $run_dir

else  #response_vxl == 8

cd $tb_dir

##echo SIMULATION STARTED AT `date`  >>$run_dir/cmd

echo "cd $tb_dir" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/pack_disp_conv_dis.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/test_tasks_pkg_rx.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/test_tasks_pkg_tx.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/txerr_ref.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/lfi_ref.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/SingleChannel_rx.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/SingleChannel_tx.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/SingleChannel.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/latchs.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/cyp15g0403dxb.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status clk_gena.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status add_tasks.vhd" >>$run_dir/cmd

echo "ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $1" >>$run_dir/cmd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/pack_disp_conv_dis.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/test_tasks_pkg_rx.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/test_tasks_pkg_tx.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/txerr_ref.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/lfi_ref.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/SingleChannel_rx.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/SingleChannel_tx.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/SingleChannel.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/latchs.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $model_dir/cyp15g0403dxb.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status clk_gena.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status add_tasks.vhd

ncvhdl -work worklib -cdslib cds.lib -logfile ncvhdl.log -update -linedebug -status $1



echo "ncelab -work worklib -cdslib cds.lib -logfile ncelab.log -access +wc -status worklib.cyp15g0403dxb_tb_top:test" >>$run_dir/cmd 

ncelab -work worklib -cdslib cds.lib -logfile ncelab.log -access +wc -status worklib.cyp15g0403dxb_tb_top:test



echo "ncsim worklib.cyp15g0403dxb_tb_top:test -input @"\""database -open vcddb -vcd   -timescale ps; probe -vcd -all -depth all; run; exit"\"";" >>$run_dir/cmd 

ncsim worklib.cyp15g0403dxb_tb_top:test -input @"database -open vcddb -vcd   -timescale ps; probe -vcd -all -depth all; run; exit";



if (("$3" == "Y") || ("$3" == "y")) then

cd $tb_dir

echo "mv ncsim.vcd $rpt_dir/$m.vcd" >>$run_dir/cmd

echo "mv ncsim.log $rpt_dir/$m.log" >>$run_dir/cmd

mv ncsim.vcd $rpt_dir/$m.vcd

mv ncsim.log $rpt_dir/$m.log

##echo SIMULATION ENDED AT `date`  >>$run_dir/cmd

\rm -rf $run_dir/run_default

mv $run_dir/cmd $run_dir/run_default

chmod 755  $run_dir/run_default

else

cd $tb_dir

\rm -rf *.vcd

echo "mv ncsim.log $rpt_dir/$m.log" >>$run_dir/cmd

mv ncsim.log $rpt_dir/$m.log

echo SIMULATION ENDED AT `date`  >>$run_dir/cmd

\rm -rf run_default

mv $run_dir/cmd $run_dir/run_default

endif # endif for $3

endif #endif for $2

cd $run_dir

exit



